<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                template="/publico/template/templatePadrao.xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.org/ui"
                xmlns:f="http://java.sun.com/jsf/core">
    <ui:define name="content">
        <h:form id="form">
            <p:growl 
                showDetail="true" 
                showSummary="true"/>
            <p:wizard backLabel="Voltar" nextLabel="Próximo" style="width: 500px">
                <p:tab id="busca" 
                       title="Buscar">
                    <h:panelGrid columns="2" cellpadding="10">
                        <h:outputText value="Buscar Usuário"/>
                        <p:autoComplete 
                            id="acSimple" 
                            value="#{loginBean.login}" 
                            var="login"
                            itemLabel="#{login.email}"
                            itemValue="#{login}"
                            converter="loginConversor"
                            forceSelection="true"
                            placeholder="Preencha o nome do usuário"
                            size="40"
                            completeMethod="#{loginBean.autoComplete}">
                            <p:column rendered="#{login.curriculo != null}">
                                <h:outputText value="#{login.curriculo.nome}"/>
                            </p:column>
                            <p:column>
                                <h:outputText value="#{login.email}"/>
                            </p:column>
                        </p:autoComplete>
                    </h:panelGrid>
                </p:tab>

                <p:tab id="edicao" 
                       title="Editar">
                    <p:panelGrid columns="2" >

                        <h:outputText 
                            value="Nome: " />
                        <h:outputText 
                            value="#{loginBean.login.curriculo.nome}" />
                        <h:outputText 
                            value="E-mail: " />
                        <h:outputText 
                            value="#{loginBean.login.email}" />

                        <h:outputText 
                            value="Tipo Usuário: " />
                        <p:selectOneMenu 
                            id="perfil" 
                            style="width: 185px" 
                            value="#{loginBean.login.perfil}">  
                            <f:selectItem 
                                itemLabel="Usuário" 
                                itemValue="U" /> 
                            <f:selectItem 
                                itemLabel="Secretaria" 
                                itemValue="S" />      
                            <f:selectItem 
                                itemLabel="Administrador" 
                                itemValue="A"  />  
                        </p:selectOneMenu>
                    </p:panelGrid>
                </p:tab>
                <p:tab id="confirmacao" 
                       title="Confirmar">
                    <p:panelGrid columns="2" >
                        <h:outputText 
                            value="Nome: " />
                        <h:outputText 
                            value="#{loginBean.login.curriculo.nome}" />
                        <h:outputText 
                            value="E-mail: " />
                        <h:outputText 
                            value="#{loginBean.login.email}" />

                        <h:outputText 
                            value="Tipo Usuário: " />
                        <h:outputText 
                            value="#{loginBean.toNomePerfil()}" />
                    </p:panelGrid>

                    <p:commandButton
                        style="float: right"
                        ajax="false"
                        value="Salvar" 
                        icon="ui-icon-check"
                        action="#{loginBean.alterarPermissao()}" />
                </p:tab>
            </p:wizard>
        </h:form>
    </ui:define>
</ui:composition>
